<!-- 首页-组件模板 -->
<template>
	<view class="homeDoms">
		<!-- 广告图 -->
		<view class="adDoms">
			<image src="/static/bn.png" mode="widthFix"></image>
		</view>
		
		<!-- 项目列表-内容 -->
		<view class="listDoms">
			<view v-for="(item, index) in list" :class="index==3?'paddingBottom20':'bordrBottom666 marginBottom30 paddingBottom30'">
				<view class="flexDom marginBottom20">
					<view class="marginRight20">
						<image v-if="index==0" class="xmDoms" src="/static/xm1.png" mode="widthFix"></image>
						<image v-if="index==1" class="xmDoms" src="/static/xm2.png" mode="widthFix"></image>
						<image v-if="index==2" class="xmDoms" src="/static/xm3.png" mode="widthFix"></image>
						<image v-if="index==3" class="xmDoms" src="/static/xm4.png" mode="widthFix"></image>
					</view>
					<view class="colorWhite flexOne">
						<view class="flexDom marginBottom20">
							<text class="xmTitle">{{item.name}}</text>
							<text class="mainColor flexOne textAlign">
								<text>{{item.distance}}km</text>
							</text>
						</view>
						<view class="marginBottom20">
							<text class="mainBg marginRight20">开店时长：{{item.time}}</text>
							<text class="color999 fontSize12">服务次数：{{item.serversNums}}</text>
						</view>
						<view class="">
							<text class="mainBg marginRight20">热情服务</text>
							<text class="mainBg marginRight20">守约准时</text>
							<text class="mainBg marginRight20">响应快</text>
						</view>
					</view>
				</view>
				<!-- 功能按钮 -->
				<view class="textAlign">
					<text class="xmBtton" @click="toNavigateTo('/pages/reservation/index?id='+item.id)">立即预约</text>
				</view>
			</view>
		</view>
	</view>
</template>

<!-- 组件核心js -->
<script>
	export default {
		data() {
			return {
				list: [
					{id:1, name: '舒乐养生', distance: 0.5, time: '10个月', serversNums: 1262},
					{id:2, name: '青禾养生', distance: 0.9, time: '3年', serversNums: 3153},
					{id:3, name: '西岚养生', distance: 1.2, time: '5年', serversNums: 5270},
					{id:4, name: '舒悦养生', distance: 2.3, time: '新店开张', serversNums: 170}
				]
			};
		},
		methods: {
			/**
			 * 跳转-其它非tab菜单
			 * */
			toNavigateTo(url) {
				uni.navigateTo({
					url: url
				})
			},
		}
	}
</script>

<!-- 当前页面css -->
<style lang="scss" scoped>
	page{
		background: #f8f8f8;
	}
	.homeDoms {
		margin: 40upx 30upx;
		.flexDom{
			display: flex;
		}
		.flexOne {
			flex: 1;
		}
		.fontSize12 {
			font-size: 24upx;
		}
		.colorWhite{
			color: #FFFFFF;
		}
		.color666{
			color: #666666;
		}
		.color999{
			color: #999999;
		}
		.textAlign{
			text-align: right;
		}
		.mainColor{
			color: #7c89d9;
		}
		.bordrBottom666{
			border-bottom: 1px solid #666666;
		}
		.paddingBottom20{
			padding-bottom: 20upx;
		}
		.paddingBottom30{
			padding-bottom: 30upx;
		}
		.marginBottom20 {
			margin-bottom: 20upx;
		}
		.marginBottom30 {
			margin-bottom: 30upx;
		}
		.marginRight20 {
			margin-right: 20upx;
		}
		.adDoms {
			margin-bottom: 40upx;
			image {
				width: 100%;
				border-radius: 20upx;
			}
		}
		.xmBtton {
			display: inline-block;
			background: #7c89d9;
			font-size: 30upx;
			color: #FFFFFF;
			padding: 15upx 40upx;
			border-radius: 40upx;
			margin-right: 20upx;
		}
		.listDoms {
			background: #FFFFFF;
			border-radius: 20upx;
			padding: 30upx 20upx;
			.xmDoms {
				width: 180upx;
			}
			.xmTitle {
				background: #7c89d9;
				font-size: 32upx;
				padding: 15upx 40upx 15upx 15upx;
				border-radius: 0 40upx 40upx 0;
				margin-right: 20upx;
			}
			.mainBg {
				display: inline-block;
				background: #7c89d9;
				padding: 10upx;
				font-size: 24upx;
				border-radius: 15upx;
			}
		}
	}
</style>
